<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:insert="~{include :: header('账户历史列表')}" />
    <th:block th:insert="~{include :: bootstrap-table-css}" />
</head>
<body class="hold-transition">
<div class="container-fluid mb-2">
    <div class="toolbar" id="toolbar" role="group">
        <form id="formId" class="form-inline">
            <input id="userId" type="hidden" th:value="${userId}">
            <select class="form-control mr-1" name="actHistoryType" th:with="type=${@dict.getType('qdx_acthistory_type')}">
                <option value="">交易类型</option>
                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
            </select>
            <select class="form-control mr-1" name="bizType" th:with="type=${@dict.getType('qdx_acthistory_biz')}">
                <option value="">业务类型</option>
                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
            </select>
            <a class="btn btn-primary btn-rounded mr-1" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
            <a class="btn btn-warning btn-rounded" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
        </form>
    </div>
    <table id="bootstrap-table" class="table-striped"></table>
</div>
<th:block th:insert="~{include :: footer}" />
<th:block th:insert="~{include :: bootstrap-table-js}" />
<script th:inline="javascript">
    var biz = [[${@dict.getType('qdx_acthistory_biz')}]];
    var typ = [[${@dict.getType('qdx_acthistory_type')}]];
    var prefix = "/account";
    var userId = $("#userId").val();
    $(function() {
        var options = {
            url: "/user/account/info/list.json?userId="+userId,
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            modalName: "账户历史",
            columns: [
                {
                    field: 'id',
                    title: 'null',
                    visible: false
                },
                {
                    field: 'balance',
                    align: 'center',
                    title: '当前余额',
                    formatter: function(value, row, index) {
                        return row.balance / 100;
                    }
                },
                {
                    field: 'backAmount',
                    align: 'center',
                    title: '现金余额',
                    formatter: function(value, row, index) {
                        return row.backAmount / 100;
                    }
                },
                {
                    field: 'vmAmount',
                    align: 'center',
                    title: '充值余额',
                    formatter: function(value, row, index) {
                        return row.vmAmount / 100;
                    }
                },
                {
                    field: 'orderAmount',
                    align: 'center',
                    title: '交易金额',
                    formatter: function(value, row, index) {
                        return row.orderAmount / 100;
                    }
                },
                {
                    field: 'actHistoryType',
                    title: '交易类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(typ, value);
                    }
                },
                {
                    field: 'bizType',
                    title: '业务类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(biz, value);
                    }
                },
                {
                    field: 'createTime',
                    title: '操作时间'
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>